library(tidyverse)
library(whereiation)

df <- msleep %>% select(-awake)
dep_var <- 'sleep_total > 12'

# df <- mpg
# dep_var <- "hwy > 25"
variation_plot_interactive(df, dep_var)
variation_plot_single_obs(df, dep_var, id = 72) #%>% plotly::ggplotly(tooltip = "label")

profile_n(df, dep_var)
sleep_total > 12: top 5 observations
field field_wt ID 40
est: 0.6345
ID 72
est: 0.6052
ID 16
est: 0.5897
ID 43
est: 0.5866
ID 73
est: 0.5866
sleep_rem 24% 05 [2.7 to 3.35)
0.667
05 [2.7 to 3.35)
0.667
03 [1.4 to 2.05)
0.6
03 [1.4 to 2.05)
0.6
03 [1.4 to 2.05)
0.6
order 24% Rodentia
0.636
Rodentia
0.636
Rodentia
0.636
small sample size small sample size
conservation 9% small sample size lc
0.444
small sample size small sample size small sample size
vore 3% herbi
0.438
herbi
0.438
omni
0.2
small sample size small sample size
brainwt 0% 01 [-0.00 to 0.57)
0.346
NA NA
0.481
01 [-0.00 to 0.57)
0.346
01 [-0.00 to 0.57)
0.346
01 [-0.00 to 0.57)
0.346
sleep_cycle 0% 01 [0.11 to 0.25)
0.643
NA NA
0.353
NA NA
0.353
01 [0.11 to 0.25)
0.643
01 [0.11 to 0.25)
0.643
find_drivers(df, dep_var)
expected_proportions(df, dep_var, sort_by = "actual")